package com.xhs.design.factory;

import com.xhs.dto.request.LoginFactoryRequest;
import com.xhs.service.FactoryLoginService;
import com.xhs.service.impl.FactoryQqLoginImpl;
import com.xhs.service.impl.FactoryWeChartLoginImpl;

/**
 * @desc: 登录工厂
 * @projectName: tools-parent
 * @author: xhs
 * @date: 2022/12/4 22:24
 * @version: JDK 1.8
 */
public class LoginFactory {

    /**
     * QQ登录
     */
    public static String QQ_LOGIN = "QQ";
    /**
     * 微信登录
     */
    public static String WE_CHART = "WeChart";

    public static FactoryLoginService getLogin(LoginFactoryRequest loginRequest) {
        FactoryLoginService myLogin = null;
        if (QQ_LOGIN.equals(loginRequest.getLoginType())) {
            myLogin = new FactoryQqLoginImpl();
            return myLogin;
        }
        if (WE_CHART.equals(loginRequest.getLoginType())) {
            myLogin = new FactoryWeChartLoginImpl();
            return myLogin;
        }
        return null;
    }
}
